package com.itheima.arrays;

import java.util.Arrays;

public class Demo {
    public static void main(String[] args) {
        //二分查找
        //注意 : 该数组一定要有序,否则会出错
        int[] arr = {1, 2, 3, 5, 6, 7, 8, 9, 10};
        System.out.println(Arrays.binarySearch(arr, 4));

        //Arrays.toString  -- 将数组以字符创形式返回
        System.out.println(Arrays.toString(arr));

        // 快速排序   Arrays.sort(Array array);
        int[] arr1 = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
        Arrays.sort(arr1);
        System.out.println(Arrays.toString(arr1));

        //Arrays.copyoOf(arr , int);
        int[] newNewArr = Arrays.copyOf(arr1, 20);
        System.out.println(Arrays.toString(newNewArr));
    }
}
